//
//  TipController.swift
//  Unzip
//
//  Created by zhibao on 2024/7/26.
//

import UIKit

class TipController: SecSuperController {
    
    var contents = [[String:String]]()
    var scrollview = UIScrollView(frame: CGRectMake(0, navigationFullHeight(), SCREEN_WIDTH, SCREEN_HEIGHT - navigationFullHeight()))
    override func viewDidLoad() {
        super.viewDidLoad()
        self.gk_navTitle = LocalizedString("问题解答")
        contents = [
            [
                "title":LocalizedString("如何导入文件？"),
                "content":LocalizedString("在导入界面，点击右下角的添加按钮，会弹出界面告知四种添加方式。")
            ],[
                "title":LocalizedString("压缩与解压"),
                "content":LocalizedString("如果文件后缀为zip,rar,7z,三种类型，则会默认解压缩。其他类型会默认压缩。")
            ],[
                "title":LocalizedString("解压差异"),
                "content":LocalizedString( "zip/7z类型解压后直接在当前目录,rar类型解压后会生成一个和当前名字一致的文件夹，里面解压后的文件。")
            ],
        ]
        self.view.addSubview(scrollview)
        var tempView:UIView?
        for i in 0 ..< contents.count {
            let tempContent = contents[i]
            let titleLabel = UILabel()
            titleLabel.text = tempContent["title"]
            titleLabel.textColor = UIColor.white
            titleLabel.numberOfLines = 0
            titleLabel.lineBreakMode = .byWordWrapping
            titleLabel.font = MY_SCALE_BoldFont(17)
            scrollview.addSubview(titleLabel)
            titleLabel.snp.makeConstraints { make in
                make.left.equalTo(20)
                make.right.equalTo(self.view).offset(-20)
                if i == 0 {
                    make.top.equalTo(0)
                }else{
                    make.top.equalTo(tempView!.snp.bottom).offset(20)
                }
            }
            
            let detailLabel = UILabel()
            detailLabel.text = tempContent["content"]
            detailLabel.textColor = UIColor.white
            detailLabel.numberOfLines = 0
            detailLabel.lineBreakMode = .byWordWrapping
            detailLabel.font = MY_SCALE_MediumFONT(14)
            scrollview.addSubview(detailLabel)
            detailLabel.snp.makeConstraints { make in
                make.left.right.equalTo(titleLabel)
                make.top.equalTo(titleLabel.snp.bottom).offset(6)
            }
            tempView = detailLabel
        }
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}
